import React,{Component,PropTypes} from 'react';
import { routerRedux } from 'dva/router';
import { connect } from 'dva';
import { Form, Input, Button, Checkbox, notification,message} from 'antd';

const FormItem = Form.Item;
const createForm = Form.create;

import './less/login.less';

class Login extends Component {
  constructor(props) {
    super(props);
    this.state = {
	  	username:void 0,
	  	password:void 0
	  };
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleSubmit(e) {
    e.preventDefault();
    this.props.dispatch(routerRedux.push({
      pathname: '/app/index'
    }));
  }

  render() {
    return (
      <div className="login-container">
        <div className="login-mask"></div>
        <Form className="login-content" horizontal onSubmit={this.handleSubmit}>
          <h2>Unit2</h2>
          <FormItem label="账号" required ={false}>
          	<Input placeholder="请输入账户名" />
          </FormItem>
          <FormItem label="密码" required ={false}>
            <Input type="password" placeholder="请输入密码"/>
          </FormItem>
          <FormItem>
	          <Checkbox style={{color:'#FFF'}}>记住我</Checkbox>
	       </FormItem>
          <FormItem>
            <Button className="ant-col-24" type="primary" htmlType="submit">登录</Button>
          </FormItem>
        </Form>
      </div>
    );
  }
}

Login = createForm()(Login);

function mapStateToProps({ login }) {
  return { login };
}

export default connect(mapStateToProps)(Login);
